<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:33:"./themes/admin/project\index.html";i:1700585510;s:40:"D:\wwwroot\ydytmz\themes\admin\base.html";i:1576462546;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $setup['title']; ?></title>
    <meta content="<?php echo $setup['keywords']; ?>" name="keywords" />
    <meta content="<?php echo $setup['description']; ?>" name="description" />
    <?php if($setup['ico'] != null): ?><link rel="shortcut icon" type="image/x-icon"  href="/public/uploads/<?php echo $setup['ico']; ?>"/><?php endif; ?>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/public/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/layuiadmin/style/admin.css" media="all">
    <!--CSS引用-->
    
    <!--页面CSS-->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!--tab标签-->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">分值管理</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form layui-form-pane" action="<?php echo url('admin/project/index'); ?>" method="get">
                        <div class="layui-form-item">
                            <label class="layui-form-label">分类</label>
                            <div class="layui-input-inline">
                                <select name="cid" lay-verify="required" lay-search="">
                                    <option value="">选择分类或直接搜索选择</option>
                                    <?php if(is_array($project_classify_level_list) || $project_classify_level_list instanceof \think\Collection || $project_classify_level_list instanceof \think\Paginator): if( count($project_classify_level_list)==0 ) : echo "" ;else: foreach($project_classify_level_list as $key=>$vo): ?>
                                    <option value="<?php echo $vo['id']; ?>" <?php if($cid==$vo['id']): ?> selected="selected"<?php endif; ?>><?php if($vo['level'] != '1'): ?>|<?php for($i=1;$i<$vo['level'];$i++){echo ' ----';} endif; ?> <?php echo $vo['title']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                            <label class="layui-form-label">关键词</label>
                            <div class="layui-input-inline">
                                <input type="text" name="keyword" value="<?php echo $keyword; ?>" placeholder="请输入关键词" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-inline">
                                <select name="status">
                                    <option value="">全部</option>
                                    <option value="2" <?php if($status==2): ?> selected="selected"<?php endif; ?>>当前显示</option>
                                    <option value="1" <?php if($status==1): ?> selected="selected"<?php endif; ?>>历史记录</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <button class="layui-btn">搜索</button>
                            </div>
                            <div class="layui-inline">
                                <a href="<?php echo url('admin/project/index',['cleanup'=>'cleanup']); ?>" class="layui-btn layui-btn-danger">清除</a>
                                <a href="/public/uploads/moban/geshi.xlsx" class="layui-btn">模版下载</a>
                                <button type="button" class="layui-btn" id="import">
                                    <i class="layui-icon">&#xe67c;</i>导入数据
                                </button>
                            </div>
                        </div>
                    </form>
                    <hr>
                    <form class="layui-form" action="">
                        <table class="layui-table" lay-size="sm">
                            <thead>
                            <tr>
                                <th style="width: 30px;">ID</th>
                                <th>分类</th>
                                <th>名称</th>
                                <th>分值</th>
                                <th>状态</th>
                                <th style="width: 130px;">创建时间</th>
                                <th style="width: 120px;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($project_list) || $project_list instanceof \think\Collection || $project_list instanceof \think\Paginator): if( count($project_list)==0 ) : echo "" ;else: foreach($project_list as $key=>$vo): ?>
                            <tr>
                                <td><?php echo $vo['id']; ?></td>
                                <td><?php echo $vo['project_classify']; ?></td>
                                <td><?php echo $vo['title']; ?></td>
                                <td><?php echo $vo['score']; ?></td>
                                <td>
                                    <?php switch($vo['status']): case "0": ?>历史记录<?php break; case "1": ?><font style="color: #ff0000;">当前显示</font><?php break; default: endswitch; ?>
                                </td>
                                <td><?php echo $vo['create_time']; ?></td>
                                <td>
                                    <div class="layui-btn-group">
                                        <a href="<?php echo url('admin/project/delete',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm ajax-delete" title="删除"><i class="layui-icon">&#xe640;</i></a>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                    </form>
                    <!--分页-->
                    <?php echo $project->render(); ?>
                </div>
            </div>
        </div>
    </div>
</div>

<!--页面-->

<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/public/layuiadmin/' //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use('index');
</script>

<script>
    layui.use(['layer','form','layer','upload'], function(){ //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer,upload = layui.upload; //独立版的layer无需执行这一句
        var form = layui.form;

        /**
         * 数据导入
         */
        var uploadInst = upload.render({
            elem: "#import" //绑定元素
            ,url: "<?php echo url('admin/project/import'); ?>" //上传接口
            ,accept: 'file' //普通文件
            ,before: function(obj){ //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
                layer.load(); //上传loading
            }
            ,done: function(res, index, upload){
                layer.closeAll('loading'); //关闭loading
                //页面层
                layer.open({
                    type: 1,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['500px', '500px'], //宽高
                    content: "<div style='padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;'>"+res.message+"</div>"
                });
            }
            ,error: function(index, upload){
                layer.closeAll('loading'); //关闭loading
            }
        });

        /**
         * 通用删除
         */
        $('.ajax-delete').on('click', function () {
            var _href = $(this).attr('href');
            layer.open({
                shade: false,
                content: '确定删除？',
                btn: ['确定', '取消'],
                yes: function (index) {
                    $.ajax({
                        url: _href,
                        type: "get",
                        success: function (info) {
                            if (info.code === 1) {
                                setTimeout(function () {
                                    location.href = info.url;
                                }, 1000);
                            }
                            layer.msg(info.msg);
                        }
                    });
                    layer.close(index);
                }
            });

            return false;
        });

    });
</script>

<!--页面JS脚本-->
</body>
</html>

